from collections import deque

if __name__ == "__main__":
    q = deque(maxlen=4)
    q.append(1)
    print(q)
    q.append(1)
    print(q)
    q.append(1)
    print(q)
    q.append(1)
    print(q)
    print(q.count(1))
    q.append(5)
    print(q)
    print(q.count(1))
